<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="/WEB-INF/tlds/c.tld" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!doctype html>
<html>
<head>
<title>微信安全支付</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<meta name="format-detection" content="telephone=no" />
<meta http-equiv="x-rim-auto-match" content="none">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0">
<link rel="stylesheet" href="${pageContext.request.contextPath}/js/wechat/style.css" />
<style type="text/css">
	.orderInfoMain label {
		display: inline-block;
		width: 76px;
		/* text-align: right; */
		color:#666666;
	}
	.orderInfoMain span {
		color:#666666;
	}
</style>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-1.11.3.min.js"></script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script> 
<script type="text/javascript">

	wx.config({
	    debug: false,
	    appId: '${appid}',
	    timestamp: '${timeStamp}',
	    nonceStr: '${nonceStr}',//'82693e11-b9bc-448e-892f-f5289f46cd0f',
	    signature: '${signature}',
	    jsApiList: ['checkJsApi',
	                'chooseWXPay']
	});
	
	wx.ready(function () {
		wx.checkJsApi({
		    jsApiList: ['chooseWXPay'], // 需要检测的JS接口列表，所有JS接口列表见附录2,
		    success: function(res) {
		    }
		});
		var aa=(11,22,33);
		  // 10.1 发起一个支付请求
		  document.querySelector('#chooseWXPay').onclick = function () {
		     wx.chooseWXPay({
		      timestamp: '${timeStamp}',//1419835025, 支付签名时间戳，注意微信jssdk中的所有使用timestamp字段均为小写。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符
		      nonceStr: '${nonceStr}',//'noncestr',
		      package : '${packagestring}',
		      signType: 'MD5', // 注意：新版支付接口使用 MD5 
		      paySign: '${paySign}',
		      success:function(res){
		    	  
		    	  document.payInfoForm.submit();
		      }
		    });  
		  };
	});
</script>
</head>
<body>
<form action="pay_complete.html"  name="payInfoForm">
<input type="hidden" name="publicAccountId" value="${weChatHeader.publicAccountId}">
<input type="hidden" name="openId" value="${weChatHeader.openId}">
	<div class="header">
		<h1><a href="javascript:history.back()"></a>确认订单</h1>
	</div>
	<div class="main" style="font-size: 14px">
		<div class="orderInfo">
			<div class="orderInfoTop clearfix">
				<ul class="orderInfoMain">
					<li>订单结算付款金额：
					<span class="fr"><em><strong style="font-size: 23px">￥
					<fmt:formatNumber type="number" value="${order.orMoney}" pattern="0.00" maxFractionDigits="2"/>
					</strong></em> </span>
					</li>
				</ul>
			</div>
			<ul class="orderInfoMain">
				<li>
					<label style="font-size: 15px">订&nbsp;&nbsp;单&nbsp;&nbsp;号：</label>
					<span style="font-size: 14px;text-align: right;">${order.orId} </span>
				</li>
				<li>
					<label style="font-size: 15px">游戏&nbsp;&nbsp;&nbsp;ID：</label>
					<span style="font-size: 14px;text-align: right;">${order.gameId} </span>
				</li>
				<li>
					<label style="font-size: 15px">商品信息：</label>
					<span style="font-size: 14px;text-align: right;">${carNub} 张房卡 </span>
				</li>
				<li>
					<label style="font-size: 15px">商品金额：</label>
					<span style="font-size: 14px">￥  
					<fmt:formatNumber type="number" value="${money}" pattern="0.00" maxFractionDigits="2"/> 
					</span>
				</li>
				<!-- <li>
					<label style="font-size: 15px">运&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;费：</label>
					<span style="font-size: 14px">￥ 0.00</span>
				</li> -->
				<%-- <c:if test="${isAgent}">
				<li>
					<label style="font-size: 15px">代理优惠：</label>
					<span style="font-size: 14px">￥<fmt:formatNumber type="number" value="${money-order.orMoney}" pattern="0.00" maxFractionDigits="2"/>  </span>
				</li>
				</c:if> --%>
			</ul>
			
			<!-- <div class="orderInfoBottom">
				<textarea name="remark" id="remark" placeholder="给宾友留言"></textarea>
			</div> -->
		</div>
	</div>
	<div class="error" style="display: ${msg==null?'none':'block'}"><span>${msg}</span></div>
	<div class="footer">
		<input type="button" id="chooseWXPay" value="购买" />
	</div>
	</form>			
</body>
</html>